import javax.jws.soap.SOAPBinding;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description: 冒泡排序法实现升序排序
 * User: 15085202591
 * Date: 2022-11-05
 * Time: 20:01
 */
public class BubbleSort {
    public static void bubbleSort(int[] array){
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = 0; j < array.length - i -1; j++) {
                if(array[j+1] < array[j]){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }
    }
    public static void main(String[] args) {
        int[] array = new int[]{1,7,3,12,44,75,47,98,22,13,15};
        System.out.println(Arrays.toString(array));
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }
}
